package com.itheima.exception;

import com.itheima.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author: 放学后海堤日记
 * @Date: 2023/4/13 20:05
 * @Desc: 全局异常处理
 */
@RestControllerAdvice
public class MyException {
    @ExceptionHandler(Exception.class)
    public R<String> exceptionHandler(Exception exception) {
        exception.printStackTrace();

        return R.error("操作失败");
    }
}
